package com.yanmaohu.nikita.data;

/**
 * @author Bright Lee
 */
public final class TypeModifier {

    private int beginIndex;
    private int endIndex;
    private boolean native_;
    private boolean protected_;
    private boolean public_;

    public TypeModifier(int beginIndex, int endIndex, boolean native_, boolean protected_, boolean public_) {
        this.beginIndex = beginIndex;
        this.endIndex = endIndex;
        this.native_ = native_;
        this.protected_ = protected_;
        this.public_ = public_;
    }

    public int getBeginIndex() {
        return beginIndex;
    }

    public int getEndIndex() {
        return endIndex;
    }

    public boolean isNative() {
        return native_;
    }

    public boolean isPrivate() {
        return !isPrivate() && !isProtected();
    }

    public boolean isProtected() {
        return protected_;
    }

    public boolean isPublic() {
        return public_;
    }

    public static boolean isPublic(TypeModifier typeModifier) {
        if (typeModifier == null) {
            return false;
        }
        return typeModifier.isPublic();
    }

}
